import { createRouter, createWebHistory } from 'vue-router'

import LoginView from '../views/LoginView.vue'
import Admin from '../views/AdminView.vue'
const routes = [
  {
    path: '/',
    name: 'login',
    component: LoginView
  },
  {
    path:'/admin',
    name:'admin',
    component:Admin,
    children:[
      {
        path:'/admin/users',
        name:'用户管理',
        keepalive:true,
        component:()=>import('../views/UsersView.vue')
      },
      {
        path:'/admin/wuliu',
        name:'投稿',
        keepalive:true,
        component:()=>import('../views/FankuiView.vue')
      },
      {
        path: '/admin/upload',
        name: '图片管理',
        component: () => import(/* webpackChunkName: "about" */ '../views/UploadView.vue')
      },
      {
        path: '/admin/star',
        name: '收藏管理',
        component: () => import(/* webpackChunkName: "about" */ '../views/StarView.vue')
      },
      {
        path: '/admin/pote',
        name: '诗词管理',
        component: () => import(/* webpackChunkName: "about" */ '../views/PoteView.vue')
      }
    ]
  },

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
